package com.iee.asserts;

import org.apache.commons.collections4.CollectionUtils;
import org.springframework.util.Assert;

import java.util.List;
import java.util.Map;

public class asserts {

    public static void main(String[] args) {
//        判断参数是否为空();
//        判断集合是否为空();
        断言条件是否为空();
        
    }

    private static void 断言条件是否为空() {
        List<String> list = null;
        Assert.isTrue(CollectionUtils.isNotEmpty(list), () -> "list不能为空");
    }


    private static void 判断集合是否为空() {
        List<String> list = null;
        Map<String, String> map = null;
        Assert.notEmpty(list, "list不能为空");
        Assert.notEmpty(list, () -> "list不能为空");
        Assert.notEmpty(map, "map不能为空");
    }

    private static void 判断参数是否为空() {
        String str = null;
        Assert.isNull(str, "str必须为空");
        Assert.isNull(str, () -> "str必须为空");
        Assert.notNull(str, "str不能为空");
    }
}
